package com.qiaofang.applet.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author: youqing.yang
 * 楼盘排序
 * @create: 2020/09/21 20:01
 **/
@Getter
@AllArgsConstructor
public enum EstateSortConstants {
    //0最新发布,1楼龄从低到高,2楼龄从高到低,3均价从低到高,4均价从高到低
    UPDATE_TIME_DESC(0, "updateTime_desc"),
    COMPLETE_YEAR_ASC(1, "completeYear_asc"),
    COMPLETE_YEAR_DESC(2, "completeYear_desc"),
    SELLPRICE_ASC(3, "sellPrice_asc"),
    SELLPRICE_DESC(4, "sellPrice_desc");

    private int code;

    private String value;

    public static EstateSortConstants getValueByCode(Integer code) {

        for (EstateSortConstants item : values()) {
            if (item.getCode() == code) {
                return item;
            }
        }
        return null;
    }
}
